package com.amit.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

public class CLab5 {

	public static void main(String[] args) {
		
		
		SessionFactory sessionfactory=ChibernateUtil.getfactory();
		
		Session session=sessionfactory.openSession();
		
		Transaction tx=session.beginTransaction();
		
		//1.Adding the Student
//		
//		Student stu=new Student("anil","lko","Disabled",155000.0);
//		
//	Integer it=(Integer) session.save(stu);
//	
//	System.out.println("1 record inserted");
//	
//	System.out.println(it.intValue());
	
//
//	//1.Adding the CurrentStudent
//	
//	CurrentStudent cstu=new CurrentStudent("amit yadav","lko","Enabled",155000.0,2000.0,"6:30PM","Mathikere");
//	
//Integer it=(Integer) session.save(cstu);
//
//System.out.println("1 record inserted");
//
//System.out.println(it.intValue());
//	
//		

//1.Adding the OldStudent
//
//OldStudent ostu=new OldStudent("aa","Blore","Enabled",155000.0,"SDSOFT","aa@sd.com",9.0);
//
//Integer it=(Integer) session.save(ostu);
//
//System.out.println("1 record inserted");
//
//System.out.println(it.intValue());

		
//1.Adding the OldStudent
//
//WeekdayStudent wdtu=new WeekdayStudent("bb","Blore","Enabled",125000.0,300.0,"6:30P.M","Mathikere","M.Sc","85.5",3);
//
//Integer it=(Integer) session.save(wdtu);
//
//System.out.println("1 record inserted");
//
//System.out.println(it.intValue());

		
//1.Adding the OldStudent

WeekdendStudent wdtu=new WeekdendStudent("cc","Blore","Enabled",125000.0,300.0,"6:30P.M","HSR","sdsoft","cc@sd.com",9.0);

Integer it=(Integer) session.save(wdtu);

System.out.println("1 record inserted");

System.out.println(it.intValue());

		
		
		tx.commit();
		
		session.close();
		
		
		

	}

}
